<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div>
    <div>接受消息</div>
    <div class="receive-message">暂无消息</div>
  </div>
</body>
<script>
  const elmMessage = document.querySelector('.receive-message')
  let message;
  window.onmessage = function (data) {
    message+=data;
    elmMessage.textContent = message;
  }
</script>
</html>